<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('用户列表')" />
	<th:block th:include="include :: layout-latest-css" />
</head>
<body class="gray-bg">
	<div class="ui-layout-center">
		<div class="container-div">
			<div class="row">
				<div class="col-sm-12 search-collapse">
					<form id="user-form">
						<input type="hidden" id="deptId" name="deptId">
		                <input type="hidden" id="parentId" name="parentId">
						<div class="select-list">
							<ul>
								<li>
									用户名称：<input type="text" name="userName"/>
								</li>
								<li>
									手机号码：<input type="text" name="phonenumber"/>
								</li>
								<li>
									<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
								</li>
							</ul>
						</div>
					</form>
				</div>

		        <div class="btn-group-sm" id="toolbar" role="group">
		            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="admin:class:export">
			            <i class="fa fa-download"></i> 导出
			        </a>
		        </div>

		        <div class="col-sm-12 select-table table-striped">
				    <table id="bootstrap-table"></table>
				</div>
			</div>
		</div>
	</div>

	<th:block th:include="include :: footer" />
	<th:block th:include="include :: layout-latest-js" />
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('admin:class:edit')}]];
		var removeFlag = [[${@permission.hasPermi('admin:class:remove')}]];
		var prefix = ctx + "admin/class";

		$(function() {
		    var options = {
		        url: prefix + "/myClassUserlist",
		        createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        removeUrl: prefix + "/remove",
		        exportUrl: prefix + "/export",
		        importUrl: prefix + "/importData",
		        importTemplateUrl: prefix + "/importTemplate",
		        sortName: "createTime",
		        sortOrder: "desc",
		        modalName: "用户",
		        columns: [{
		            checkbox: true
		        },
		        {
		            field: 'userId',
		            title: '用户ID'
		        },
		        {
		            field: 'loginName',
		            title: '登录名称',
		            sortable: true,
					visible: false
		        },
		        {
		            field: 'userName',
		            title: '用户名称'
		        },
		        {
		            field: 'email',
		            title: '邮箱',
		            visible: false
		        },
		        {
		            field: 'phonenumber',
		            title: '手机'
		        },
				{
					field: 'detectionStatus',
					title: '核酸检测状态（14天内）',
					formatter: function (value, row, index) {
						if (row.detectionStatus == 1) {
							return '<strong style="color: #00a65a">正常</strong>';
						} else if (row.detectionStatus == 2) {
							return '<strong style="color: #de0505">有阳性记录！</strong>';
						}
					},
				},
				{
					field: 'wayrecordStatus',
					title: '途径地状态（14天内）',
					formatter: function (value, row, index) {
						if (row.wayRecordStatus == 0) {
							return '<strong style="color: #00a65a">正常</strong>';
						} else if (row.wayRecordStatus == 1) {
							return '<strong style="color: #de0505">'+row.wayRecordStatusStr+'</strong>';
						}
					},
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                if (row.userId != 1) {
		                	var actions = [];
			                actions.push('<a title="移除" class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="memRemove(\'' + row.userId + '\')"><i class="fa fa-remove"></i></a> ');
							actions.push('<a title="途径地情况" class="btn btn-success btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="wayModel(\'' + row.userId + '\')"><i class="fa fa-location-arrow"></i></a> ');
							actions.push('<a title="核酸检测情况" class="btn btn-warning btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="detectionModel(\'' + row.userId + '\')"><i class="fa fa-reorder"></i></a> ');
							actions.push('<a title="疫苗接种情况" class="btn btn-info btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="vaccinationModel(\'' + row.userId + '\')"><i class="fa fa-eyedropper"></i></a> ');
							actions.push('<a title="身体情况" class="btn btn-primary btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="bodyModel(\'' + row.userId + '\')"><i class="fa fa-male"></i></a> ');
							return actions.join('');
		            	} else {
		                    return "";
		                }
		            }
		        }]
		    };
		    $.table.init(options);
		});


		/* 班级成员移除 */
		function memRemove(id) {
			$.modal.confirm("确认要移除该成员吗？", function() {
				$.operate.post(prefix + "/memRemove", {"userId": id});
			})
		}

		// 途径地记录
		function wayModel(userId){
			$.modal.open("途径地记录", prefix + "/wayModel/"+userId);
		}
		// 身体状况记录
		function bodyModel(userId){
			$.modal.open("身体状况记录", prefix + "/bodyModel/"+userId);
		}
		// 疫苗接种情况记录
		function vaccinationModel(userId){
			$.modal.open("疫苗接种情况记录", prefix + "/vaccinationModel/"+userId);
		}
		// 核酸检测记录
		function detectionModel(userId){
			$.modal.open("核酸检测记录", prefix + "/detectionModel/"+userId);
		}


	</script>
</body>
</html>
